package com.entrogy.service;

import com.alibaba.fastjson.JSONObject;
import com.entrogy.bean.*;
import org.apache.ibatis.annotations.Param;


import java.util.List;
import java.util.Map;

public interface UserService {

    /**
     * 根据手机号码 查询出用户信息
     * @param mobile
     * @return
     */
    UserEntity getUserByMobile(String mobile);

	/**
	 * 新增老师 方法
	 * @param userEntity
	 * @return
	 */
	boolean insertUser(EditUserEntity userEntity);

    Map<String, Object> login(String phone, String password, Role role);

    List<UserEntity> findUsers(String teacherName, String mobile);

	boolean updateUser(EditUserEntity userEntity);

	boolean deleteUser(String userId);

    List<UserEntity> findUsersRowBound(String teacherName, String mobile, Integer schoolCode, String teacherId);

    int countUser(Integer schoolCode, String teacherName);

	/**
	 *   根据id查询用户信息
	 * @param dingdingId
	 * @return
	 */
	UserEntity getUserById(@Param(value = "dingdingId") String dingdingId);

	/**
	 * 根据用户ID查询用户信息
	 * @param uid
	 * @return
	 */
    UserEntity getUserByUid(String uid);
	/**
	 * 根据用户id 分配课程权限
	 * @param course_id
	 * @param id
	 * @return
	 */
	int  UpdateDistributionByUser(@Param(value="course_id") String  course_id,@Param(value="id") String  id);

	/**
	 *   根据用户id查询课程信息
	 * @param id
	 * @return
	 */
	int  SelectDistributionByUser(@Param(value="id") String  id);

	/**
	 * 根据班主任查询出其所在班级的学生列表
	 * @param uid
	 * @return
	 */
	List<StudentEntity> getStudentsByBanzhu(String uid,int schoolCode);

	/**
	 * 德育处获取班主任的离校设置状态 看那些人没有做
	 * @return
	 * @param schoolCode
	 */
	List<LeaveSchoolSetEntity> getLeaveSchool(Integer schoolCode);

//	/**
//	 * 判断用户是否是生活老师
//	 * @param uid
//	 * @return
//	 */
//	Boolean isLifeTeacher(String uid);
//
//	/**
//	 * 判断用户是否是保安队的
//	 * @param uid
//	 * @return
//	 */
//	Boolean isConstabulary(String uid);
//
//	/**
//	 * 判断用户是否是德育处的
//	 * @param uid
//	 * @return
//	 */
//    boolean isDeyuchu(String uid);
//
//	/**
//	 * 判断用户是否是班主任
//	 * @param uid
//	 * @return
//	 */
//	boolean isClassLeader(String uid);
//
//	/**
//	 * 判断用户是否是年级组长
//	 * @param uid
//	 * @return
//	 */
//	boolean isGradeLeader(String uid);
//
//	/**
//	 * 判断用户是否是科任老师
//	 * @param teacherId
//	 * @return
//	 */
//    boolean isCourseTeacher(String teacherId);

	/**
	 * 根据家长id查询对应的孩子的班主任的id
	 * @param parentId
	 * @param schoolCode
	 * @param classId
	 * @return
	 */
    TeacherBasicInfoEntity getTeacherIdByParentId(String parentId, Integer schoolCode, Integer classId);

	/**
	 * 查询应该处理该申请的班主任的id
	 * @param params
	 * @return
	 */
    TeacherBasicInfoEntity getTeacherIdByClassId(Map<String, Integer> params);

	/**
	 * 根据班主任id查询邀请码以及班级名称
	 * @param uid
	 * @return
	 */
	JSONObject getClassInfo(String uid);

	/**
	 * 根据创建用户的schoolCode查询该校的职位id
	 * @param schoolCode
	 * @return
	 */
    String getTeacherPositionId(Integer schoolCode);

	/**
	 * 根据用户id查询schoolCode
	 * @return
	 */
	Integer getSchoolCodeByUserId(String userId);

	/**
	 * 获取该校所有教职员工
	 * @param schoolCode
	 * @return
	 */
    List<JSONObject> listSchoolAllUser(Integer schoolCode);

	/**
	 * 修改用户密码
	 * @param userId
	 * @param newPassword
	 * @return
	 */
    boolean updateUserPassword(String userId, String newPassword);

	/**
	 * 将教师电话号码和微信号解绑
	 * @param mobile
	 * @return
	 */
	boolean cancelWeiXinAndPhoneBind(String mobile);

	/**
	 * 查询学校内的教师
	 * @param schoolCode
	 * @param gradeId
	 * @param classId
	 * @param teacherIds
	 * @param teacherName
	 * @return
	 */
    List<UserEntity> listSchoolTeacher(Integer schoolCode, Integer gradeId, Integer classId, String[] teacherIds, String teacherName);

	boolean updateUserThdid(String userId, int thdId);

    List<UserEntity> listHasSomePermissionUserIdList(Integer schoolCode, String permissionCode);

	boolean insertUserInfoChangeApply(TeacherInformationChangeEntity teacherInformationChange);

	TeacherDetailInfoEntity getTeacherInformationChangeDetail(Integer changeId);

	String updateUser(TeacherDetailInfoEntity changeInfo);

	List<TeacherBasicInfoEntity> listTeacher(Integer schoolCode, String teacherId, Integer positionId);

	List<TeacherBasicInfoEntity> listRegisterTeacher(Integer schoolCode, Integer changeType, String teacherId);

	TeacherDetailInfoEntity getTeacherDetailInfo(String teacherId);

	String insertUserByApply(TeacherDetailInfoEntity changeInfo);

	boolean updateInfoChangeStatus(Integer changeId, Integer agreed, String opinion, String roleIds);

	Integer getTeacherInfoChangeRecord(String applyUserId, String newPhone);

    List<Integer> listChangeId(Integer schoolCode);

	List<TeacherPositionEntity> listSchoolPosition(Integer schoolCode);

	List<TeacherBasicInfoEntity> listSchoolTeacherForPosition(Integer schoolCode, Integer positionId);

	List<TeacherBasicInfoEntity> listTeacherContact(Integer schoolCode);

    boolean updateUserInfo(String teacherId, String teacherPhotoUrl);

	int countSchoolTeacher(Integer schoolCode, Integer gradeId, Integer classId, String[] teacherIds, String teacherName);

	List<UserEntity> importTeacher(Integer schoolCode, Integer roleId);

	TeacherInformationChangeEntity listTeacherChangeRecord(Integer changeId);

	List<String> listUserIdentity(String phone);

	/**
	 * 查询教师信息（运维查询）
	 * @param schoolCode
	 * @param teacherPhone
	 * @param teacherName
	 * @return
	 */
	List<TeacherBasicInfoEntity> listTeacherForMaintenance(Integer schoolCode, String teacherPhone, String teacherName);
}
